
-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 04/03/2016 23:38:53
-- Generated from EDMX file: D:\MyJobs\Projects\ProfessionalSamples\Part4\Chapter33\Formula1Samples\Formula1Model.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [Formula1Database];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO

-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------


-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------


-- --------------------------------------------------
-- Creating all tables
-- --------------------------------------------------

-- Creating table 'Race'
CREATE TABLE [dbo].[Race] (
    [ID] int IDENTITY(1,1) NOT NULL
);
GO

-- Creating table 'RaceResult'
CREATE TABLE [dbo].[RaceResult] (
    [ID] int IDENTITY(1,1) NOT NULL
);
GO

-- Creating table 'Racer'
CREATE TABLE [dbo].[Racer] (
    [ID] int IDENTITY(1,1) NOT NULL,
    [FirstName] nvarchar(max)  NOT NULL,
    [LastName] nvarchar(max)  NOT NULL,
    [Nationality] nvarchar(max)  NOT NULL,
    [Starts] nvarchar(max)  NOT NULL,
    [Points] nvarchar(max)  NOT NULL,
    [DateOfBirth] nvarchar(max)  NOT NULL,
    [DateOfDeath] nvarchar(max)  NOT NULL
);
GO

-- --------------------------------------------------
-- Creating all PRIMARY KEY constraints
-- --------------------------------------------------

-- Creating primary key on [ID] in table 'Race'
ALTER TABLE [dbo].[Race]
ADD CONSTRAINT [PK_Race]
    PRIMARY KEY CLUSTERED ([ID] ASC);
GO

-- Creating primary key on [ID] in table 'RaceResult'
ALTER TABLE [dbo].[RaceResult]
ADD CONSTRAINT [PK_RaceResult]
    PRIMARY KEY CLUSTERED ([ID] ASC);
GO

-- Creating primary key on [ID] in table 'Racer'
ALTER TABLE [dbo].[Racer]
ADD CONSTRAINT [PK_Racer]
    PRIMARY KEY CLUSTERED ([ID] ASC);
GO

-- --------------------------------------------------
-- Creating all FOREIGN KEY constraints
-- --------------------------------------------------

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------